package com.atguigu.spzx.manager.service.impl;

import com.atguigu.spzx.manager.mapper.BrandMapper;
import com.atguigu.spzx.manager.service.BrandService;
import com.atguigu.spzx.model.entity.product.Brand;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 分类品牌(Brand)表服务实现类
 *
 * @author makejava
 * @since 2024-03-20 11:55:50
 */
@Service
public class BrandServiceImpl implements BrandService {

    @Autowired
    private BrandMapper brandMapper;

    @Override
    public PageInfo<Brand> GetBrandPageList(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum , pageSize);
        List<Brand> brandList = brandMapper.findByPage() ;
        PageInfo pageInfo = new PageInfo(brandList) ;
        return pageInfo;
    }

    @Override
    public void saveBrand(Brand brand) {
        brandMapper.saveBrand(brand);
    }

    @Override
    public void UpdateBrandById(Brand brand) {
        brandMapper.UpdateBrandById(brand);
    }

    @Override
    public void deleteById(Long id) {
        brandMapper.deleteById(id);
    }

    @Override
    public List<Brand> findAll() {
        return brandMapper.findByPage();
    }


}
